vcSimInterface
vcSimInterface is a behavior used for connecting components physically or remotely to one another and exchanging data. This "one to one interface" base class supports connecting only to single other interface at a time, but can have multiple sections.
See in: Overview
Module: vcBehaviors
Parent: vcBehavior
Children: vcOneToManyInterface
Referenced by: vcSimInterfaceSection.Interface
Properties
Learn how to use properties here. The properties are also inherited from the parent class.
| Name | Type | Access | Description |
| AngleTolerance | Real | RW | Gets or sets an angle tolerance for allowing interfaces to connect to the interface when not aligned on same axis. |
| ConnectedComponent | vcComponent | R | Gets the component connected to interface.See moreIf no connection, value is None. Exceptions: RuntimeError: When the owning component hasn't been initialized. |
| ConnectedFromSections | vcList[vcSimInterfaceSection] | R | Gets gets a list of all sections in this interface that have an active connection to another interface. If no connection, the value is an empty list. |
| ConnectedToSections | vcList[vcSimInterfaceSection] | R | Gets a list of sections in other interfaces which are connected to sections of this interface. If no connection, value is an empty list. |
| DistanceTolerance | Real | RW | Gets or sets the distance at which the interface snaps to an available connection, thereby completing Plug and Play. |
| IsAbstract | Boolean | RW | Gets or sets a value indicating whether this interface supports remote connections.See moreWhen False, the interfaces need to be aligned in the 3D world when connected. Exceptions: RuntimeError: When this interface is connected. |
| IsConnected | Boolean | R | Gets a value indicating whether this interface is currently connected to any other interface. |
| Sections | vcList[vcSimInterfaceSection] | R | Gets a list of all sections in interface. If no sections, value is an empty list. |
Methods
Learn how to use methods here. The methods are also inherited from the parent class.
| Name | Return Type | Parameters | Description |
| canConnect | Boolean | vcSimInterface interface | Returns True if a given interface can connect to the interface; otherwise, returns False.See moreTriggers the OnMatch event, which can affect the result. Parameters: interface (vcSimInterface): The interface to connect to this interface. Returns: bool: True when connection is possible. False otherwise. |
| cancelConnectionChange | None | None | Requests that the current Connect or Disconnect operation to be cancelled.See moreOnly has effect if called from either OnConnecting or OnDisconnecting event handler. The operation may have been cancelled already by an earlier event handler, or may get cancelled by an another Python or .NET handler after this one. |
| connect | Boolean | vcSimInterface interface, Optional Keyword[retainOffset = Boolean] | Tries to connect a given interface to this interface. The OnMatch and OnConnecting event handlers can prevent the connection. See moreParameters: interface (vcSimInterface): The interface to connect. retainOffset (bool): Whether to retain the offset when attaching component to another using Hierarchy field. Returns: bool: True when connection succeeded or was cancelled. False otherwise. |
| createSection | vcSimInterfaceSection | String sectionName | Adds a new section of a given name to interface, and then returns the new section.See moreParameters: sectionName (str): Name to assign to the section. Empty string is replaced with "Unnamed" Returns: vcSimInterfaceSection: The created section object. Exceptions: RuntimeError: When this interface is connected. |
| disconnect | Boolean | Optional Keyword[otherInterface = vcSimInterface] | Tries to remove all or specific connections in this interface.See moreAn optional otherInterface argument can be used to disconnect a specific interface from the interface, for example when interface is one-to-many. OnDisconnecting event handlers can prevent the disconnection. Parameters: otherInterface (vcSimInterface): Other interface to disconnect from. Returns: bool: True when disconnect succeeded or was cancelled. False otherwise. Exceptions: RuntimeError: When node hierarchy of the component is locked. |
| overrideMatchResult | None | Boolean enableOverride, Boolean matchResult | Overrides default internal interface matching constraints to either accept or decline a connection match with another interface.See moreOnly has an effect if called from OnMatch event handler. Parameters: enableOverride (bool): Whether to enable the override mechanism. False means the default internal logic is used. matchResult (bool): The desired result. True means the interfaces are considered to match regardless of the default internal matching rules. |
Events
Learn how to use events here. The events are also inherited from the parent class.
| Name | Parameters | Description |
| OnConnect | vcSimInterface otherInterface, bool retainOffset | Triggered when interface is connected to another interface.See moreParameters: otherInterface (vcSimInterface): The interface that was connected. retainOffset (bool): See retainOffset parameter in the connect method. |
| OnConnecting | vcSimInterface otherInterface | Triggered when interface is about to be connected to another interface.See moreThe connection can be cancelled by calling the cancelConnectionChange() method from the event handler. Parameters: otherInterface (vcSimInterface): The interface about to be connected to this interface. |
| OnDisconnect | vcSimInterface otherInterface | Triggered when interface is disconnected from another interface.See moreParameters: otherInterface (vcSimInterface): Interface that was disconnected from this interface. |
| OnDisconnecting | vcSimInterface otherInterface | Triggered when interface is about to be disconnected from another interface.See moreThe disconnection can be cancelled by calling the cancelConnectionChange() method from the event handler. Parameters: otherInterface (vcSimInterface): The interface about to be disconnected from this interface. |
| OnMatch | vcSimInterface otherInterface | Triggered when interfaces are tested as being able to connect to one another.See moreOccurs during Plug And Play operations, automatic connecting of components, and when connecting interfaces through API. Parameters: otherInterface (vcSimInterface): The candidate for connection being tested. |
Example: Find Connected Component From Interface Behavior
""" This example shows how to get a handle to the component that is connected via interface behavior. """ import vcCore as vc comp = vc.getComponent() interface = comp.findBehavior("PathInterface") connected_comp = interface.ConnectedComponent print (connected_comp.Name)